<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->



<html>
    <head>
        <title>学校注册</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <style>
            body {
                font-family: 'Open Sans', sans-serif;
                line-height: 30px;
                background:url('assets/img/background9.jpg')no-repeat;
                height:100%;
                width:100%;
                overflow: hidden;
                background-size:cover;
            }
            .alp-div {
                filter:alpha(Opacity=80);
                -moz-opacity:0.5;
                opacity: 0.7;
                background-color: #000;
                color:#fff;
                text-align:left;
                padding: 20px;
                position: absolute;
                top: 100px;
                width:420px;
                height:450px;
                left:50%;
                top:50%; 
                margin-left:-210px;
                margin-top:-225px;
                border:1px solid #fff;
            }
            .button-center {
                margin-top: 10px;
                text-align:center;
            }
            .btn {
                width: 150px;
                height: 60px;
                font-size: 20px;
            }
            .btn-left{
                margin-right: 20px;
            }
            .btn-right{
                margin-left: 20px;
            }
            button:hover{
                color: #2945a5;
            }
            input{
                width: 200px;
            }
            #leave_date {
                width: 100px;
            }
            #meeting_date{
                width: 100px;
            }
            #leave_time{
                width: 95px;
            }
            #meeting_time{
                width: 95px;
            }
            select{
                width: 150px;
            }
        </style>
    </head>
    <body>
        <?PHP
        if (!empty($_GET['email'])) {$email = $_GET['email'];} else {$email = '';}
        $mysqli = mysqli_init();
        $mysqli->options(MYSQLI_OPT_CONNECT_TIMEOUT, 2); //设置超时时间
        $mysqli->real_connect('127.0.0.1', 'root', 'mysql');
        $sql = "CREATE DATABASE IF NOT EXISTS CUPT DEFAULT CHARSET utf8 COLLATE utf8_general_ci;";
        if ($mysqli->query($sql) == TRUE) {
        //printf("Table CUPT successfully created.\n");
        }
        mysqli_select_db($mysqli, "CUPT");
        $sql="select * from school_information_list where `email`='$email'";
        $rst = $mysqli->query($sql);
        $name ='';
        $school ='';
        $taxpayer_identification_number ='';
        $invoice_title='';
        $single_rooms ='';
        $standard_rooms ='';
        $meeting_datetime ='';
        $leave_datetime = '';
        $halal_foods = '';
        $school_number = '';
        while ($row = mysqli_fetch_assoc($rst)) {
        $name = $row['name'];
        $school = $row['school'];
        $taxpayer_identification_number = $row['taxpayer_identification_number'];
        $invoice_title=$row['invoice_title'];
        $single_rooms = $row['single_rooms'];
        $standard_rooms = $row['standard_rooms'];
        $meeting_datetime = $row['meeting_datetime'] ;
        $leave_datetime = $row['leave_datetime'] ;
        $halal_foods = $row['halal_foods'];
        $school_number = $row['school_number'];
        }
        ?>
        <div class="alp-div">
            <form action="" name="school_signup" method="post" >
                <input type="email" class="form-control" required="required" id="email" name="email" placeholder="email" value="<?PHP echo $email;?>"/>&nbsp;&nbsp;&nbsp;队伍负责人邮箱<br /> 
                <input type="password" class="form-control" required="required" id="password" name="password" placeholder="密码" />&nbsp;&nbsp;&nbsp;队伍负责人密码<br /> 
                <input type="text" class="form-control" required="required" id="school"  name="school" list="school_list" placeholder="学校" value="<?PHP echo $school;?>"/>&nbsp;&nbsp;&nbsp;学校<br />
                <datalist id="school_list" >
                    <?PHP
                    $school_arr=['哈尔滨工业大学（深圳）','华南理工大学','华中科技大学','华中师范大学','暨南大学','南方科技大学','武汉大学','湘潭大学','中南大学','中山大学'];
                    for($i=0;$i<=9;$i++){
                    echo "<option value='$school_arr[$i]'>$school_arr[$i]</option>";
                    }
                    ?>
                </datalist>
                <input type="text" class="form-control" required="required" id="name" name="name" placeholder="注册人姓名" value="<?PHP echo $name;?>"/>&nbsp;&nbsp;&nbsp;注册人姓名<br />
                <input type="text" class="form-control" required="required" id="taxpayer_identification_number" name="taxpayer_identification_number" placeholder="纳税人识别号" value="<?PHP echo $taxpayer_identification_number;?>"/>&nbsp;&nbsp;&nbsp;纳税人识别号<br />
                <input type="text" class="form-control" required="required" id="invoice_title" name="invoice_title" placeholder="发票抬头" value="<?PHP echo $invoice_title;?>"/>&nbsp;&nbsp;&nbsp;发票抬头<br />
                <input type="number" class="form-control" required="required" id="single_rooms" name="single_rooms" placeholder="单间数量" value="<?PHP echo $single_rooms;?>"/>&nbsp;&nbsp;&nbsp;单间数量<br />
                <input type="number" class="form-control" required="required" id="standard_rooms" name="standard_rooms" placeholder="标间数量" value="<?PHP echo $standard_rooms;?>"/>&nbsp;&nbsp;&nbsp;标间数量<br />
                <input type="date" class="form-control" required="required" id="meeting_date" name="meeting_date" placeholder="到会日期" /><input type="time" class="form-control" required="required" id="meeting_time" name="meeting_time" placeholder="到会时间" />&nbsp;&nbsp;&nbsp;到会时间<br />
                <input type="date" class="form-control" required="required" id="leave_date" name="leave_date" placeholder="离会日期" /><input type="time" class="form-control" required="required" id="leave_time" name="leave_time" placeholder="离会时间" />&nbsp;&nbsp;&nbsp;离会时间<br />
                <input type="number" class="form-control" required="required" id="halal_foods" name="halal_foods" placeholder="需要清真食品人数" value="<?PHP echo $halal_foods;?>"/>&nbsp;&nbsp;&nbsp;需要清真食品人数<br />
                <div class="button-center">
                    <button class="btn btn-left" onclick="signup()">提交学校注册信息</button>
                    <button class="btn btn-right" onclick="modify()">修改学校注册信息</button>
                </div>
            </form>
        </div>
        <script type='text/javascript'>
            function signup() {
                document.school_signup.action = "school-signup.php?flag=0";
                document.school_signup.submit();
            }
            function modify() {
                document.school_signup.action = "school-signup.php?flag=1";
                document.school_signup.submit();
            }
        </script>
    </body>
</html>
